<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../../d3.js"></script>
<script>

var svg = d3.select("body").append("svg")
    .attr("width", 960)
    .attr("height", 500);

var g = svg.append("g")
    .attr("transform", "translate(100,100)")
  .append("g")
    .attr("transform", "translate(0,0)rotate(0)");

var rect = g.append("rect")
    .attr("x", -25)
    .attr("y", -50)
    .attr("width", 50)
    .attr("height", 100);

g.transition()
    .duration(3000)
    .attrTween("transform", d3.tween("translate(100,100)rotate(360)", d3.interpolateString));

</script>
